package main

import (
	"time"
)

type myWeekday int

const (
	Sunday myWeekday = iota
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

var myWeeks = []string{
	"周日",
	"周一",
	"周二",
	"周三",
	"周四",
	"周五",
	"周六",
}

func (d myWeekday) String() string {
	if Sunday <= d && d <= Saturday {
		return myWeeks[d]
	}
	return "星期数值超界了！"
}
func timeCreate() time.Time {
	s := "2024/09/10 09:30:00 +0800"
	tn, err := time.Parse("2006/01/02 15:04:05 -0700", s)
	if err != nil {
		panic(err)
	}
	return tn
}

func timePast(tn time.Time) (tp time.Time, tpMs int64, tpWeek myWeekday, tpWeekPast int, tnYearDay int) {
	tp = tn.AddDate(-8, 0, 0)
	tpMs = tp.UnixMilli()
	tpWeek = myWeekday(tp.Weekday())
	tpWeekPast = tp.YearDay() / 7
	tnYearDay = tn.YearDay()
	return tp, tpMs, tpWeek, tpWeekPast, tnYearDay
}
